import axios from 'axios'

export const baseURL = 'http://127.0.0.1:3005/'

// 创建axios实例
const service = axios.create({
  baseURL,
  timeout: 3000
})

service.interceptors.request.use((config) => {
  // console.log('========axios request拦截:',config)
  //业务逻辑
  return config
}, err=>{
  console.log('axios request err---',err)
  return Promise.reject(err)
})

service.interceptors.response.use((response)=>{
  // console.log('========axios response拦截:',response)
  // 剥离外层 返回data
  return response.data
}, err => {
  return Promise.reject(err)
})




export default service